/*
 * Created on Jun 29, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.vectrics.recruiter.job.event;

import java.util.Locale;

import org.vectrics.event.Event;
import org.vectrics.mail.EmailHtmlBase;
import org.vectrics.mail.MailMessage;
import org.vectrics.recruiter.job.Job;

/**
 * @author MMoore
 */
public class JobStatusChangeEmailBuilder extends JobEmailBuilderBase {
	
	public JobStatusChangeEmailBuilder(Event event, Job job, Locale locale) {
		super(event, job, locale);
	}

	public boolean supportsHtml() {
		return(true);
	}
	
	public String getSubject() {
		return (this.getPhrase("email.subject.job.status.changed") + ": " 
				+ this.getJob().getTitle()
				 + " (" + this.getJob().getReferenceId() + ")");
	}
	
	
	public MailMessage getTextMailMessage() {
		MailMessage message = new MailMessage(this.getDomain());
		message.setContentType(MailMessage.CONTENT_TEXT);
		message.setBody("Job status change"
				+ "\r\nCompany:  " + this.getJob().getCompany().getName()
				+ "\r\nJob:      " + this.getJob().getTitle()
				+ "\r\nRef Code: " + this.getJob().getReferenceId()
	//			+ "\r\nDate:     " + DateUtil.getDateFormatRoundToMinute(locale).format(job.getCurrentStatus().getDateStart())
				);
		message.setSubject(this.getSubject());
		return(message);
	}
	

	protected EmailHtmlBase createHtmlEmail() {
		return new JobStatusChangeHtmlEmail(this.getLocale(), this.getJob());
	}

}
